package com.gmj.controller;


import com.gmj.entity.Class;
import com.gmj.service.IClassService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author gmj
 * @since 2022-01-29
 */
@RestController
@RequestMapping("/class")
public class ClassController {
    @Autowired
    private IClassService cs;
    @GetMapping("/selectAll")
    public List<Class> selectAll(){
        return cs.list();
    }
    @PostMapping("/add")
    public void add(@RequestBody Class clazz){
        cs.save(clazz);
    }
    @DeleteMapping("/delete/{id}")
    public void delete(@PathVariable("id") int id){
        cs.removeById(id);
    }
}

